/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBean.TX.tta;

import entity.establishment.Stakeholder;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import session.TX.StakeholderAccountsSBRemote;

/**
 *
 * @author Lu Xiaodi
 */
@ManagedBean
@RequestScoped
public class CheckBIPaymentMB {

    @EJB
    StakeholderAccountsSBRemote stakeholderBean;

    /** Creates a new instance of CheckBIPaymentMB */
    public CheckBIPaymentMB() {
    }

    public boolean checkIsPaid() {
        Long stakeholderId; 
        try {
            stakeholderId = (Long) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholderId");
            Stakeholder s = stakeholderBean.findStakeholder(stakeholderId);
            if (s == null) {
                return false;
            }
            return s.isPurchaseBI();
        } catch (Exception e) {
            return false;
        }
    }
}
